home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PD ROM 1
/
PD ROM Volume I - Macintosh Software from BMUG (1988).iso
/
Graphics
/
Graphic Demos
/
PseudoPS
/
stack.c
< prev
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
UTF-8
Wrap
C/C++ Source or Header
|
1987-06-09
|
285 b
|
20 lines
|
[
TEXT/KAHL
]
#define STKSIZE 10
float stack[STKSIZE], *StkPtr = stack;
push(x)
float x;
{
if (StkPtr >= stack + STKSIZE) return(-1); /* stack overflow */
*(++StkPtr) = x;
return(0);
}
pop(x)
float *x;
{
if (StkPtr < stack) return(-1); /* stack underflow */
*x = *StkPtr--;
return(0);
}